<?php

namespace app\api\validate;

use think\Validate;

class User extends Validate
{

    protected $rule = [
        'username' => 'require',
        'phone_number' => 'require',
        'code' => 'require',
//        'type' => ["require","in" => "1,2"],
        'type' => 'require',
        'sex' => ['require','in' => "0,1,2"]
    ];

    protected $message = [
        'username.require' => '用户名必须填写',
        'phone_number.require' => '手机号必须填写',
        'code.require' => '验证码必须填写',
        'type.in' => '类型数值错误',
        'sex.require' => '性别必须',
        'sex.in' => '性别数值错误',
    ];

    protected $scene = [
        'send_code' => ['phone_number'],
        'login' => ['phone_number','code','type'],
        'update_user' => ['username','sex'],
    ];
}